<template>
  <h2>reactive-setup属性</h2>
  <span>{{ state.count }}</span>
  <button @click="add">+</button>
</template>

<script setup>
// 因为没有this了，所以需要从vue里面结构nextTick，相当于之前的this.$nextTick
import { reactive, nextTick } from "vue";

const state = reactive({
  count: 3,
});

const add = () => {
  state.count++;
  nextTick(() => {
    console.log(document.querySelector("span").innerHTML);
  });
};
</script>
